Network Time Protocol Library  
 

Retrieve the current date and time from a network time server. The library supports the Network Time Protocol and provides functions that return date and time values for applications that need a network-based time reference.

Reference

Library Information

File Name CSTIMV12.DLL
Version 12.0.3041.1380
LibID 79C32362-35E2-4115-9F08-043C7F982BB8
Import Library CSTIMV12.LIB
Dependencies None
Standards RFC 868, RFC 5905

Overview

The Network Time Protocol library obtains the current date and time from a server using NTP, as specified in RFC 5905, or the older TIME protocol described in RFC 868. Returned values represent Coordinated Universal Time (UTC) and can be adjusted for the local time zone. The API represents time as elapsed seconds from midnight on January 1, 1900.

The library supports returning date and time values as either 32-bit or 64-bit integers. The 32-bit functions are provided for compatibility with existing applications, but have a limited range of representable dates. In particular, a signed 32-bit time value representing the number of seconds since January 1, 1900 cannot represent dates beyond February 7, 2036. The 64-bit functions eliminate this limitation and support a much larger range of dates.

It is important to note that NTP and UNIX timestamps use different epochs and should not be used interchangeably. NTP timestamps are based on an epoch of 00:00:00 UTC on January 1, 1900 and use a 32-bit seconds field that spans approximately 136 years. This field rolls over on February 7, 2036, beginning a new NTP era. UNIX time, which is commonly used by C runtime time functions, instead measures time relative to 00:00:00 UTC on January 1, 1970. The well-known 2038 rollover applies to implementations that represent UNIX time as a signed 32-bit value and is distinct from the NTP era rollover in 2036.

Although most Windows systems synchronize their clocks with a network time server, an application ordinarily has to trust that the local system clock is accurate. The NTP API provides an alternative by allowing applications to obtain the current date and time directly from a time server. This can be useful when an application needs to independently verify the current time rather than relying exclusively on the local system clock.

It is recommended that new applications use the functions that return 64-bit integer time values and select NTP version 4 by specifying a server on port 123. The TIME protocol on port 37 remains available for compatibility, but its use is deprecated in favor of NTP.

Requirements

The SocketTools Library Edition is compatible with any programming language that can call functions exported from a standard Windows DLL. If you are using Visual Studio, the minimum supported version is Visual Studio 2010 with Service Pack 1 (SP1). The header files are compatible with modern C/C++ compilers, and function declarations are provided for several other languages. We recommend installing the latest updates for your development tools and the Windows SDK.

SocketTools supports Windows 7 SP1, Windows Server 2008 R2 SP1, and later desktop and server versions of Windows, with Windows 8.1 as the minimum supported version for Windows 8-based systems. Both 32-bit and 64-bit Windows platforms are supported for application development. Windows on ARM requires Windows 10 build 1709 or later. We recommend using a version of Windows that is currently supported by Microsoft for application development.

SocketTools provides 32-bit x86, 64-bit x64, and native ARM64 libraries. The x86 libraries maintain compatibility with legacy development tools and can run under emulation on Windows on ARM. Native ARM32 applications are not supported because Microsoft discontinued support for 32-bit ARM applications in Windows.

For native ARM64 development, we recommend Visual Studio 2019 or later. Some development tools, including recent versions of Embarcadero Delphi, support Windows on ARM using the ARM64EC architecture. ARM64EC applications can use x64 DLLs through emulation, but cannot load native ARM64 DLLs. Developers targeting ARM64EC should use the SocketTools x64 libraries rather than the native ARM64 libraries.

Import libraries are provided in COFF format for x86, x64, and ARM64 platforms. OMF libraries are also provided for x86, and ELF libraries for x64, to support older Borland and Embarcadero compilers. Visual Studio developers should use the standard COFF libraries. Some programming languages can call exported DLL functions directly without requiring an import library.

Distribution

When distributing an application that uses this library, we recommend installing the SocketTools DLL in the same folder as the application executable. This simplifies deployment and avoids potential conflicts with other applications that use different versions of the library. The DLL must be compatible with the application's processor architecture (x86, x64, or ARM64). If the library is installed in a shared system location, the installer should manage it as a shared DLL to prevent other applications from being affected when it is updated or removed. SocketTools libraries are standard Windows DLLs, not ActiveX components, and do not require COM registration.

This library has no external runtime dependencies beyond the standard Windows system libraries. It does not require the Microsoft Visual C++ Redistributable or any additional third-party libraries to be installed. All required components are either provided by Windows or statically linked into the SocketTools DLLs, simplifying deployment and eliminating the need to distribute additional runtime files.